package com.li.designpattern.interpreter;

public class Test {
	public static void main(String[] args) {
		PlayContext context=new PlayContext();
		context.setPalyText("S2AABBCCM1M2S1");

		while(context.getPalyText().length()>0){
			String str=context.getPalyText().substring(0,1);
			Expression ex=null;
			switch(str){
			case "M":ex=new ScaleExpression();break;
			case "S":ex=new SpeedExpression();break;
			case "A":
			case "B":
			case "C":
				ex=new NoteExpression();break;
			}
			ex.interpret(context);
		}
	}
}
